package com.demo.no1springboot.service.impl;

import com.demo.no1springboot.mapper.UsersMapper;
import com.demo.no1springboot.pojo.Users;
import com.demo.no1springboot.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class UsersServiceImpl implements UsersService {
    @Autowired
    UsersMapper usersMapper;

    @Override
    public int addUser(Users users) {
        return usersMapper.insertSelective(users);
    }
    public List<Users> queryUsers() {
        return usersMapper.selectAll();
    }

    @Override
    public Users login(Users users) {
        return usersMapper.selectOne(users);
    }

    @Override
    public Integer deleteById(Integer id) {
        return usersMapper.deleteByPrimaryKey(id);
    }
}